#include "Process/process.hpp"
#include "Process/observer.hpp"

Process::Process(States *_state, WorkType _type):state(_state), w_type(_type)
{
	m_count = 0;
	AddFrameFlag = true;
	_obvs = new vector<Observer*>;
}

void Process::Attach(Observer* obv)
{
	_obvs->push_back(obv);
}

void Process::Detach(Observer* obv)
{
	if (obv != NULL)
		;//找到了删除。_obvs->remove(obv);
}

void Process::Do(Image &image)
{
	vector<Observer*>::iterator it = _obvs->begin();
	for (;it != _obvs->end(); it ++)
	{
		(*it)->Update(image);
	}

	ToDo(image);
}

void Process::Swap(Image &image)
{
	swap(image, prv_image);
	AddFrameFlag = true;
}
